Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

362
Visualizações
[Violation]Added non-passive event listener to a scroll-blocking 'touchstart' event

I just started working with Three.js & everytime I try to use the onchange event, I keep getting this non-passive event listener violation for my onchange event. please help.

ERROR : [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

CODE :

"use strict";
import * as THREE from "https://unpkg.com/three@0.141.0/build/three.module";
import * as dat from "https://cdn.skypack.dev/dat.gui";


// Adding the gui //
const gui = new dat.GUI();
const world = {
    plane: {
        width: 10
    }
}
gui.add(world.plane, 'width', 1, 20).
onchange = function() {
    console.log(planeMesh.geometry);
    // planeMesh.geometry.dispose();
    // planeMesh.geometry = new THREE.planeGeometry(world.plane.width, 10, 10, 10);
}

// Instantiating scene, camera & renderer //
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
camera.position.z = 5;
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth,window.innerHeight);
document.body.appendChild(renderer.domElement);

// Building the geometry & material //
const planeGeometry = new THREE.PlaneGeometry(10, 10, 10, 10);
const planeMaterial = new THREE.MeshPhongMaterial({ 
    color: 0xff0000,
    side: THREE.DoubleSide,
    flatShading: THREE.FlatShading
 });

// Binding the geometry and material //
const planeMesh = new THREE.Mesh(planeGeometry,planeMaterial);

// Adding the planeMesh to the scene // 
scene.add( planeMesh );

const {array} = planeMesh.geometry.attributes.position;
for(let i=0; i<array.length; i += 3){
    const x = array[i];
    const y = array[i+1];
    const z = array[i+2];
    array[i+2] = z + Math.random();
}

// Adding light //
const light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(0,0,1);
scene.add(light);

// Animating & rendering the design //
function animate() {
    requestAnimationFrame( animate );
    renderer.render( scene, camera );
};

animate();

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda